﻿using AopFilters;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace MyWebApiApp.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [KmAsyncResourceFilter]
    public class TestController : ControllerBase
    {
        public TestController()
        {
            Console.WriteLine("控制器构造函数执行...");
        }

        [HttpGet]      
        public string GetMsg(string s)
        {
            Console.WriteLine("GetMsg接口执行...");
            return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff  ") + s;
        }

        [HttpGet]
        [IgnoreFilters(typeof(KmAsyncAlwaysRunResultFilter))]
        public string GetMsg2(string s)
        {
            Console.WriteLine("GetMsg2接口执行...");
            return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff  ") + s;
        }
    }
}
